﻿<%@ Control Language="C#" AutoEventWireup="true" Inherits="HL.Lib.MVC.CPViewControl" %>
<% 
    var model = ViewBag.Model as ModNewsModel;
    var entity = ViewBag.Data as ModNewsEntity;
%>
<form id="hlForm" name="hlForm" method="post">
<input type="hidden" id="_hl_action" name="_hl_action" />
<div id="toolbar-box">
    <div class="t">
        <div class="t">
            <div class="t">
            </div>
        </div>
    </div>
    <div class="m">
        <div class="toolbar-list" id="toolbar">
            <%= GetDefaultAddCommand()%>
        </div>
        <div class="pagetitle icon-48-article">
            <h2>
                Bài viết :
                <%=  model.RecordID > 0 ? "Chỉnh sửa" : "Thêm mới"%></h2>
        </div>
        <div class="clr">
        </div>
    </div>
    <div class="b">
        <div class="b">
            <div class="b">
            </div>
        </div>
    </div>
</div>
<div class="clr">
</div>
<%= ShowMessage()%>
<script type="text/javascript">
    window.addEvent('domready', function () { new Accordion($$('div#content-sliders-.pane-sliders > .panel > h3.pane-toggler'), $$('div#content-sliders-.pane-sliders > .panel > div.pane-slider'), { onActive: function (toggler, i) { toggler.addClass('pane-toggler-down'); toggler.removeClass('pane-toggler'); i.addClass('pane-down'); i.removeClass('pane-hide'); Cookie.write('jpanesliders_content-sliders-', $$('div#content-sliders-.pane-sliders > .panel > h3').indexOf(toggler)); }, onBackground: function (toggler, i) { toggler.addClass('pane-toggler'); toggler.removeClass('pane-toggler-down'); i.addClass('pane-hide'); i.removeClass('pane-down'); if ($$('div#content-sliders-.pane-sliders > .panel > h3').length == $$('div#content-sliders-.pane-sliders > .panel > h3.pane-toggler').length) Cookie.write('jpanesliders_content-sliders-', -1); }, duration: 300, opacity: false, alwaysHide: true }); });
</script>
<%if (model.RecordID > 0)
  { %>
<script type="text/javascript">
    document.switcher = null;
    window.addEvent('domready', function () {
        toggler = document.id('submenu');
        element = document.id('tab-document1');
        if (element) {
            document.switcher = new JSwitcher(toggler, element, { cookieName: "app1" });
        }
    });
</script>
<%} %>
<div id="submenu-box">
    <div class="t">
        <div class="t">
            <div class="t">
            </div>
        </div>
    </div>
    <div class="m">
        <div class="submenu-box">
            <div class="submenu-pad">
                <ul id="submenu" class="configuration">
                    <li><a id="tab2" class="active">Bài viết</a></li>
                    <%if (model.RecordID > 0)
                      { %>
                    <li><a id="tab1">Hình minh họa</a></li>
                    <li><a id="tab3">Thuộc tính tìm kiếm</a></li>
                    <%} %>
                </ul>
                <div class="clr">
                </div>
            </div>
        </div>
        <div class="clr">
        </div>
        <div class="clr">
        </div>
    </div>
    <div class="b">
        <div class="b">
            <div class="b">
            </div>
        </div>
    </div>
</div>
<div id="tab-document1" class="col width-100">
    <div id="page-tab2" class="tab">
        <div id="element-box">
            <div class="t">
                <div class="t">
                    <div class="t">
                    </div>
                </div>
            </div>
            <div class="m">
                <div class="width-70 fltlft">
                    <fieldset class="adminform">
                        <legend>THÔNG TIN CHUNG</legend>
                        <table class="admintable">
                            <tr>
                                <td class="key">
                                    <label>
                                        Tiêu đề :</label>
                                </td>
                                <td>
                                    <input class="text_input" type="text" name="Name" value="<%=entity.Name %>" maxlength="255" />
                                </td>
                            </tr>
                            <tr>
                                <td class="key">
                                    <label>
                                        Mã :</label>
                                </td>
                                <td>
                                    <input class="text_input" type="text" name="Code" value="<%=entity.Code %>" maxlength="255" />
                                </td>
                            </tr>
                            <tr>
                                <td class="key">
                                    <label>
                                        Tóm tắt :</label>
                                </td>
                                <td>
                                    <%--                                    <textarea class="ckeditor" style="height: 100px; width: 98%" name="Summary"><%=entity.Summary%></textarea>
                                    --%>
                                    <textarea style="height: 100px; width: 98%" name="Summary"><%=entity.Summary%></textarea>
                                </td>
                            </tr>
                            <tr>
                                <td class="key">
                                    <label>
                                        Giới thiệu ở trang chủ :</label>
                                </td>
                                <td>
                                    <textarea class="ckeditor" style="height: 100px; width: 98%" name="Intro"><%=entity.Intro%></textarea>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" align="center" style="text-align: center" class="key">
                                    NỘI DUNG
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" class="content">
                                    <textarea class="ckeditor" style="width: 100%; height: 500px" name="Content" id="Content"><%=entity.Content%></textarea>
                                </td>
                            </tr>
                            <tr>
                                <td class="key">
                                    <label>
                                        Địa chỉ nhà hàng :</label>
                                </td>
                                <td>
                                    <textarea class="ckeditor" style="height: 100px; width: 98%" name="Address"><%=entity.Address%></textarea>
                                </td>
                            </tr>
                            <tr>
                                <td class="key">
                                    <label>
                                        Email nhà hàng :</label>
                                </td>
                                <td>
                                    <input class="text_input" type="text" name="Email" value="<%=entity.Email %>" maxlength="255" />
                                </td>
                            </tr>
                            <%--                            <tr>
                                <td colspan="2" align="center" style="text-align: center" class="key">
                                    Khuyến mãi
                                </td>
                            </tr>
                            <tr>
                                <td align="center" style="text-align: center" colspan="2">
                                    <input name="Promotion" <%= entity.Promotion ? "checked" : "" %> type="radio" onclick="showp(this.value)"
                                        value='1' />
                                    Có
                                    <input name="Promotion" <%= !entity.Promotion ? "checked" : "" %> type="radio" onclick="showp(this.value)"
                                        value='0' />
                                    Không
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" align="center" style="text-align: center" class="key">
                                    Chi tiết Khuyến mãi
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" class="content">
                                    <div id="pt" style="display: none;">
                                        <textarea class="ckeditor" style="width: 100%; height: 500px;" name="PromotionText"
                                            id="PromotionText"><%=entity.PromotionText%></textarea></div>
                                </td>
                                        
                            </tr>
                            <tr>
                                <td colspan="2" align="center" style="text-align: center" class="key">
                                    Thực đơn
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" class="content">
                                    <textarea class="ckeditor" style="width: 100%; height: 500px;" name="Menu" id="Menu"><%=entity.Menu%></textarea>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" align="center" style="text-align: center" class="key">
                                    Dịch vụ
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" class="content">
                                    <textarea class="ckeditor" style="width: 100%; height: 500px;" name="Service" id="Service"><%=entity.Service%></textarea>
                                </td>
                            </tr>--%>
                        </table>
                    </fieldset>
                </div>
                <div class="width-30 fltrt">
                    <div id="content-sliders-" class="pane-sliders">
                        <div class="panel">
                            <h3 class="pane-toggler title" id="publishing-details">
                                <a href="javascript:void(0);"><span>THUỘC TÍNH</span></a></h3>
                            <div class="pane-slider content">
                                <table class="admintable">
                                    <tr>
                                        <td align="center" style="text-align: center" class="key">
                                            Hình minh họa - File tải về (Tài liệu)
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <%if (!string.IsNullOrEmpty(entity.File))
                                              { %>
                                            <%= Utils.GetMedia(entity.File, 100, 80, string.Empty, true, "id='img_view'")%><%}
                                              else
                                              { %>
                                            <img id="img_view" width="100" height="80" />
                                            <%} %>
                                            <br />
                                            <input class="text_input" type="text" name="File" id="File" style="width: 65%" value="<%=entity.File %>" />
                                            <input class="text_input" style="width: 75px;" type="button" onclick="ShowFileForm('File');return false;"
                                                value="Chọn ảnh" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center" style="text-align: center" class="key">
                                            Logo - nhà hàng
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <%if (!string.IsNullOrEmpty(entity.Logo))
                                              { %>
                                            <%= Utils.GetMedia(entity.Logo, 100, 80, string.Empty, true, "id='img_view2'")%><%}
                                              else
                                              { %>
                                            <img id="img_view2" width="100" height="80" />
                                            <%} %>
                                            <br />
                                            <input class="text_input" type="text" name="Logo" id="Logo" style="width: 65%" value="<%=entity.Logo %>" />
                                            <input class="text_input" style="width: 75px;" type="button" onclick="ShowFileForm('Logo');return false;"
                                                value="Chọn ảnh" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center" style="text-align: center" class="key">
                                            Chuyên mục
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <select name="MenuID" id="MenuID" class="text_input">
                                                <option value="0">Root</option>
                                                <%= Utils.ShowDDLMenuByType("News", model.LangID, entity.MenuID)%>
                                            </select>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center" style="text-align: center" class="key">
                                            Khu vực
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <select name="AreaID" id="AreaID" class="text_input">
                                                <option value="0">Root</option>
                                                <%= Utils.ShowDDLMenuByType2("Area", model.LangID, entity.AreaID)%>
                                            </select>
                                        </td>
                                    </tr>
                                    <%--                                    <tr>
                                        <td align="center" style="text-align: center" class="key">
                                            Sức chứa của phòng
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <select name="Capacity" id="Capacity" class="text_input">
                                                <option value="0">Root</option>
                                                <%= Utils.ShowDDLMenuByType2("Capacity", model.LangID, entity.Capacity)%>
                                            </select>
                                        </td>
                                    </tr>--%>
                                    <tr>
                                        <td align="center" style="text-align: center" class="key">
                                            Vị trí
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <%= Utils.ShowCheckBoxByConfigkey("Mod.NewsState", "ArrState", entity.State)%>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center" style="text-align: center" class="key">
                                            Kích cỡ hiển thị ảnh tại trang danh sách
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <select name="SizeImage" id="SizeImage" class="text_input">
                                                <%= Utils.ShowDDLMenuByType2("SizeImage", model.LangID, entity.SizeImage)%>
                                            </select>
                                        </td>
                                    </tr>
                                    <!--bổ sung-->
                                    <tr>
                                        <td align="center" style="text-align: center" class="key">
                                            Ảnh khuyến mãi (link ảnh cách nhau bằng dấu ',')
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <%--                                            <%if (!string.IsNullOrEmpty(entity.PromotionText))
                                              { %>
                                            <%= Utils.GetMedia(entity.PromotionText, 100, 80, string.Empty, true, "id='PromotionText_i'")%><%}
                                              else
                                              { %>
                                            <img id="PromotionText_i" width="100" height="80" />
                                            <%} %>
                                            <br />
                                            <input class="text_input" type="text" name="PromotionText" id="PromotionText" style="width: 65%"
                                                value="<%=entity.PromotionText %>" />
                                            <input class="text_input" style="width: 75px;" type="button" onclick="ShowFileForm('PromotionText');return false;"
                                                value="Chọn ảnh" />--%>
                                            <textarea class="text_input" style="height: 100px;" name="PromotionText" id="PromotionText"><%=entity.PromotionText%></textarea>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center" style="text-align: center" class="key">
                                            Ảnh thực đơn - hình ảnh (link ảnh cách nhau = dấu ',')
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <%--                                            <%if (!string.IsNullOrEmpty(entity.Menu))
                                              { %>
                                            <%= Utils.GetMedia(entity.Menu, 100, 80, string.Empty, true, "id='Menu_i'")%><%}
                                              else
                                              { %>
                                            <img id="Menu_i" width="100" height="80" />
                                            <%} %>
                                            <br />
                                            <input class="text_input" type="text" name="Menu" id="Menu" style="width: 65%" value="<%=entity.Menu %>" />
                                            <input class="text_input" style="width: 75px;" type="button" onclick="ShowFileForm('Menu');return false;"
                                                value="Chọn ảnh" />--%>
                                            <textarea class="text_input" style="height: 100px;" name="Menu" id="Menu"><%=entity.Menu%></textarea>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center" style="text-align: center" class="key">
                                            Ảnh dịch vụ - bảng giá (link ảnh cách nhau = dấu ',')
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <%--                                            <%if (!string.IsNullOrEmpty(entity.Service))
                                              { %>
                                            <%= Utils.GetMedia(entity.Service, 100, 80, string.Empty, true, "id='Service_i'")%><%}
                                              else
                                              { %>
                                            <img id="Service_i" width="100" height="80" />
                                            <%} %>
                                            <br />
                                            <input class="text_input" type="text" name="Service" id="Service" style="width: 65%"
                                                value="<%=entity.Service %>" />
                                            <input class="text_input" style="width: 75px;" type="button" onclick="ShowFileForm('Service');return false;"
                                                value="Chọn ảnh" />--%>
                                            <textarea class="text_input" style="height: 100px;" name="Service" id="Service"><%=entity.Service%></textarea>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center" style="text-align: center" class="key">
                                            Ảnh bản đồ
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <%if (!string.IsNullOrEmpty(entity.Map))
                                              { %>
                                            <%= Utils.GetMedia(entity.Map, 100, 80, string.Empty, true, "id='Map_i'")%><%}
                                              else
                                              { %>
                                            <img id="Img1" width="100" height="80" />
                                            <%} %>
                                            <br />
                                            <input class="text_input" type="text" name="Map" id="Map" style="width: 65%" value="<%=entity.Map %>" />
                                            <input class="text_input" style="width: 75px;" type="button" onclick="ShowFileForm('Map');return false;"
                                                value="Chọn ảnh" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="center" style="text-align: center" class="key">
                                            Đường dẫn bản đồ
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <textarea class="text_input" style="height: 100px;" name="MapUrl" id="MapUrl"><%=entity.MapUrl%></textarea>
                                        </td>
                                    </tr>
                                    <!---->
                                    <%if (CPViewPage.UserPermissions.Approve)
                                      {%>
                                    <tr>
                                        <td align="center" style="text-align: center" class="key">
                                            Duyệt
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <input name="Activity" <%= entity.Activity ? "checked" : "" %> type="radio" value='1' />
                                            Có
                                            <input name="Activity" <%= !entity.Activity ? "checked" : "" %> type="radio" value='0' />
                                            Không
                                        </td>
                                    </tr>
                                    <%} %>
                                </table>
                            </div>
                        </div>
                        <div class="panel">
                            <h3 class="pane-toggler title" id="basic-options">
                                <a href="javascript:void(0);"><span>THÔNG TIN THÊM</span></a></h3>
                            <div class="pane-slider content">
                                <textarea class="text_input" style="height: 100px;" name="Custom" id="custom"><%=entity.Custom%></textarea>
                                <textarea class="text_input" style="height: 50px;" name="set_custom" id="set_custom"></textarea>
                                <table width="99%">
                                    <tr>
                                        <td width="100%">
                                            <input name="rSetCustom" onclick="GetCustom(this.value)" type="radio" value="IsName"
                                                checked="checked" />Hiện tiêu đề (0/1)
                                            <br />
                                            <input name="rSetCustom" onclick="GetCustom(this.value)" type="radio" value="IsSummary" />Hiện
                                            tóm tắt (0/1)
                                            <br />
                                            <%--<input name="rSetCustom" onclick="GetCustom(this.value)" type="radio" value="AllowComment" />Cho phép gửi phản hồi (0/1)--%>
                                            <input name="rSetCustom" onclick="GetCustom(this.value)" type="radio" value="Keywords" />Từ
                                            khóa
                                            <br />
                                            <input name="rSetCustom" onclick="GetCustom(this.value)" type="radio" value="Description" />Diễn
                                            giải
                                        </td>
                                        <td>
                                            <input type="button" class="text_input" style="width: 100px;" onclick="SetCustom(); return false;"
                                                value="Cập nhật" />
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="clr">
                </div>
            </div>
            <div class="b">
                <div class="b">
                    <div class="b">
                    </div>
                </div>
            </div>
        </div>
    </div>
    <%if (model.RecordID > 0)
      { %>
    <div id="page-tab1" class="tab">
        <iframe src="/TTVPortal/FormImage/Index.aspx/NewsID/<%=model.RecordID %>" style='position: static;
            top: 240px; left: 0px; width: 101%; height: 1100px; z-index: 999; overflow: auto;'
            frameborder='no'></iframe>
    </div>
    <div id="page-tab3" class="tab">
        <iframe src="/TTVPortal/FormNewsProperty/Index.aspx/NewsID/<%=model.RecordID %>"
            style='position: static; top: 240px; left: 0px; width: 101%; height: 1100px;
            z-index: 999; overflow: auto;' frameborder='no'></iframe>
    </div>
    <%} %>
</div>
<script type="text/javascript" src="/{CPPath}/Content/ckeditor/ckeditor.js"></script>
<script type="text/javascript">
    CKFinder.setupCKEditor(null, '/{CPPath}/Content/ckfinder/');

    function refreshPage(arg) {
        arg = '~' + arg;
        document.getElementById(name_control).value = arg;
        if (name_control == 'File') {
            if (document.getElementById("img_view"))
                document.getElementById("img_view").src = arg.replace('~/', '/{ApplicationPath}');
        }
        if (name_control == 'Logo') {
            if (document.getElementById("img_view2"))
                document.getElementById("img_view2").src = arg.replace('~/', '/{ApplicationPath}');
        }
        if (name_control == 'PromotionText') {
            if (document.getElementById("PromotionText_i"))
                document.getElementById("PromotionText_i").src = arg.replace('~/', '/{ApplicationPath}');
        }
        if (name_control == 'Menu') {
            if (document.getElementById("Menu_i"))
                document.getElementById("Menu_i").src = arg.replace('~/', '/{ApplicationPath}');
        }
        if (name_control == 'Services') {
            if (document.getElementById("Services_i"))
                document.getElementById("Services_i").src = arg.replace('~/', '/{ApplicationPath}');
        }
        if (name_control == 'Map') {
            if (document.getElementById("Map_i"))
                document.getElementById("Map_i").src = arg.replace('~/', '/{ApplicationPath}');
        }
    }

    GetCustom('IsName');

</script>
<%--<script type="text/javascript">
    var obj = document.getElementById('pt');
    function showp(value) {
        if (value == "1") obj.style.display = 'block'; else obj.style.display = 'none'
    }
    if ('<%=entity.Promotion %>' == 'True') {
        showp(1);
    }
</script>--%>
</form>
